#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

struct element{
	int op,id,ps;ll fac,ifac;
}s1[N],s2[N],s3[N],ans[N];

bool cmp1(element a,element b){return a.ps ^ b.ps ? a.ps < b.ps : a.fac > b.fac;}
bool cmp2(element a,element b){return a.fac * b.ifac > b.fac * a.ifac;}
bool cmp3(element a,element b){return a.op < b.op;}

int a[N],t1,t2,t3,k,m,n;

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in,k = in;
	for(int i = 1;i <= n;i++) a[i] = in;
	for(int i = 1;i <= m;i++){
		int op = in,pos = in,x = in;
		if(op == 1 && x > a[pos]) s1[++t1] = (element){op,i,pos,x,1};
		if(op == 2) s2[++t2] = (element){op,i,pos,x,1};
		if(op == 3) s3[++t3] = (element){op,i,pos,x,1};
	}
	sort(s1+1,s1+t1+1,cmp1);
	for(int i = 1;i <= t1;i++)
		if(s1[i].ps != s1[i-1].ps) s2[++t2] = (element){s1[i].op,s1[i].id,s1[i].ps,s1[i].fac - a[s1[i].ps],1};
	sort(s2+1,s2+t2+1,cmp1); ll s = 0;
	for(int i = 1;i <= t3;i++) s3[i].fac--;
	for(int i = 1;i <= t2;i++){
		if(s2[i].ps != s2[i-1].ps) s = a[s2[i].ps];
		s3[++t3] = (element){s2[i].op,s2[i].id,s2[i].ps,s2[i].fac,s}; s += s2[i].fac;
	}
	sort(s3+1,s3+t3+1,cmp2); int tot = min(t3,k);
	for(int i = 1;i <= tot;i++) ans[i] = s3[i];
	sort(ans+1,ans+tot+1,cmp3);
	printf("%d\n",tot); 
	for(int i = 1;i <= tot;i++) printf("%d%c",ans[i].id," \n"[i==tot]);
	return 0;
}
